package com.dyp.modulith_demo.model0.ctr;

import com.dyp.modulith_demo.model0d.ServiceAApi;
import com.dyp.modulith_demo.model0d.InfoProviderApi;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController(value = "model0")
@RequestMapping(value = "/api/v0")
public class RestfulCtr {

    private final ServiceAApi serviceA;
    private final InfoProviderApi infoProvider;

    public RestfulCtr(ServiceAApi serviceA, InfoProviderApi infoProvider){
        this.serviceA = serviceA;
        this.infoProvider = infoProvider;
    }

    @GetMapping("/info")
    public String testConfig(){
        serviceA.functionA("hai");
        return "info 0";
    }

    @GetMapping("/info-provider")
    public String testConfigFromProvider(){
        return infoProvider.provideMoreInfo();
    }
}
